<?php

function createBasicUser($userTypeIn, $userNameIn, $passwordIn, $emailIn) {

    include("include/dbtables.php");

    // Form our basic user creation query
    $createUser = "INSERT INTO $TABLE_USERS 
    ($TABLE_USERS_USERTYPE, $TABLE_USERS_USERNAME, 
    $TABLE_USERS_PASSWORD, $TABLE_USERS_LASTCONNECTED, 
    $TABLE_USERS_ENTRYDATE, $TABLE_USERS_EMAILADDRESS) 
    VALUES ($userTypeIn, '$userNameIn', '$passwordIn', 0, ".date("U").", '$emailIn')";

    // Create the user
    mysql_query($createUser);
}
function createFinancialUser($userIdIn, $nameIn, $addressIn, $phoneNumLandIn, 
        $phoneNumCellIn, $occupationIn, $employerIn, $employerAddressIn, 
        $ccNumberIn, $ccCodeIn, $mothersMaidenNameIn) {

    include("include/dbtables.php");

    // Form our financial user creation query
    $createFinUser = "INSERT INTO $TABLE_FINANCIALUSER 
    ($TABLE_FINANCIALUSER_USERID, $TABLE_FINANCIALUSER_NAME, $TABLE_FINANCIALUSER_ADDRESS,
    $TABLE_FINANCIALUSER_PHONELAND, $TABLE_FINANCIALUSER_PHONECELL, $TABLE_FINANCIALUSER_OCCUPATION,
    $TABLE_FINANCIALUSER_EMPLOYER, $TABLE_FINANCIALUSER_EMPLOYERADDRESS, 
    $TABLE_FINANCIALUSER_CREDITCARDNUM, $TABLE_FINANCIALUSER_CREDITCARDCODE, 
    $TABLE_FINANCIALUSER_PASSWORDQUESTION, $TABLE_FINANCIALUSER_BLACKMARK) 
    VALUES ($userIdIn, '$nameIn', '$addressIn', $phoneNumLandIn, $phoneNumCellIn, '$occupationIn',  
    '$employerIn', '$employerAddressIn', '$ccNumberIn', '$ccCodeIn', '$mothersMaidenNameIn', NULL)";
    
    // Create the registered user associated to $userIdIn
    mysql_query($createFinUser);
}
function createRegisteredUser($userIdIn, $nameIn, $addressIn, $phoneNumLandIn, 
        $phoneNumCellIn, $occupationIn, $employerIn, $employerAddressIn, 
        $ccNumberIn, $ccCodeIn, $mothersMaidenNameIn) {

    include("include/dbtables.php");

    // Form our registered user creation query
    $createRegUser = "INSERT INTO $TABLE_REGISTEREDUSER 
    ($TABLE_REGISTEREDUSER_USERID, $TABLE_REGISTEREDUSER_NAME, $TABLE_REGISTEREDUSER_ADDRESS,
    $TABLE_REGISTEREDUSER_PHONELAND, $TABLE_REGISTEREDUSER_PHONECELL, $TABLE_REGISTEREDUSER_OCCUPATION,
    $TABLE_REGISTEREDUSER_EMPLOYER, $TABLE_REGISTEREDUSER_EMPLOYERADDRESS, 
    $TABLE_REGISTEREDUSER_CREDITCARDNUM, $TABLE_REGISTEREDUSER_CREDITCARDCODE, 
    $TABLE_REGISTEREDUSER_PASSWORDQUESTION, $TABLE_REGISTEREDUSER_BLACKMARK) 
    VALUES ($userIdIn, '$nameIn', '$addressIn', $phoneNumLandIn, $phoneNumCellIn, '$occupationIn',  
    '$employerIn', '$employerAddressIn', '$ccNumberIn', '$ccCodeIn', '$mothersMaidenNameIn', NULL)";
    
    // Create the registered user associated to $userIdIn
    mysql_query($createRegUser);
}

function createBusinessUser($userId, $companyName, $businessCharter, 
                        $contactName, $contactPhoneLand, $contactPhoneMobile, 
                        $contactPhoneFax, $contactPosition, $contactEmail, 
                        $companyAddress, $companyCity, $companyState, 
                        $companyPostalCode, $companyCountry, $companyEmail, $preferredIndustry) {
    
    include("include/dbtables.php");
    
    // Form our business user creation query
    $createBusinessUser = "INSERT INTO $TABLE_BUSINESSAGENT 
    ($TABLE_BUSINESSAGENT_USERID, $TABLE_BUSINESSAGENT_COMPANYNAME, $TABLE_BUSINESSAGENT_BUSINESSCHARTER, 
    $TABLE_BUSINESSAGENT_CONTACTNAME, $TABLE_BUSINESSAGENT_CONTACTPHONELAND, 
    $TABLE_BUSINESSAGENT_CONTACTPHONEMOBILE, $TABLE_BUSINESSAGENT_CONTACTPHONEFAX, 
    $TABLE_BUSINESSAGENT_CONTACTPOSITION, $TABLE_BUSINESSAGENT_CONTACTEMAIL, 
    $TABLE_BUSINESSAGENT_COMPANYADDRESS, $TABLE_BUSINESSAGENT_COMPANYCITY, 
    $TABLE_BUSINESSAGENT_COMPANYSTATE, $TABLE_BUSINESSAGENT_COMPANYPOSTALCODE, 
    $TABLE_BUSINESSAGENT_COMPANYCOUNTRY, $TABLE_BUSINESSAGENT_COMPANYEMAIL, 
    $TABLE_BUSINESSAGENT_PREFERREDINDUSTRY) 
    VALUES ($userId, '$companyName', '$businessCharter', '$contactName', $contactPhoneLand, $contactPhoneMobile, 
            $contactPhoneFax, '$contactPosition', '$contactEmail', '$companyAddress', 
            '$companyCity', '$companyState', '$companyPostalCode', '$companyCountry', '$companyEmail', 
            '$preferredIndustry')";
    
    // Create the business user associated to $userIdIn
    mysql_query($createBusinessUser);
}
?>
